home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / tour_.js < prev    next >
Encoding:
JavaScript  |  2003-02-21  |  5.5 KB  |  205 lines

  1. /* Copyright (c) Microsoft Corporation.  All rights reserved. */
  2. var mSlideIdx = 0;
  3. var mNextSlide = "yes";
  4. var mTransition = RandomTrans();
  5. var mImgRoot = "images/";
  6. var mUrlWindow = 0;
  7. var mUrlWindowSafe = true;
  8. var IN     = 0;
  9. var OUT     = 1;
  10. var DELAY_FILTER = 25;
  11. var SLIDE_ROOT = "slide";
  12. var SLIDE_EXT = ".htm"
  13. var mCallNumber = 0;
  14. function OnLoad(){
  15.     CenterTourContainer();
  16.     StartSpeed();
  17.     idTopicsTitle.innerText = L_mTopicsCaption_TEXT;
  18.     mSlideIdx= 0 ;
  19.     MakeVisible();
  20.     DisplaySlide(0);
  21.     idBody.style.visibility = "visible";
  22. }
  23. function URLWindowSafe(){
  24.     mUrlWindowSafe = true;
  25. }
  26. function OpenURL(sURL){
  27.     if (!mUrlWindowSafe) return;
  28.     mUrlWindowSafe = false;
  29.     if ( typeof(mUrlWindow.closed) == "boolean" ){
  30.         if ( mUrlWindow.closed == false ) mUrlWindow.close();
  31.     }
  32.     mUrlWindow = window.open(sURL, null, "");
  33.     window.setTimeout("URLWindowSafe()", 150);
  34. }
  35. function StartSpeed(){
  36.     SpeedButtonOn(idSpeedButton[2]);
  37.     mSpeed = GetSpeed(idSpeedButton[2]);
  38. }
  39. function CenterTourContainer(){
  40.     idTourContainerLayer1.style.left =(document.body.clientWidth/2) - (idTourContainerLayer1.offsetWidth/2);
  41.     idTourContainerLayer1.style.top =(document.body.clientHeight/2) - (idTourContainerLayer1.offsetHeight/2);
  42.     idTourContainerLayer2.style.left =(document.body.clientWidth/2) - (idTourContainerLayer2.offsetWidth/2);
  43.     idTourContainerLayer2.style.top =(document.body.clientHeight/2) - (idTourContainerLayer2.offsetHeight/2);
  44.     idTourContainerLayer3.style.left =(document.body.clientWidth/2) - (idTourContainerLayer3.offsetWidth/2);
  45.     idTourContainerLayer3.style.top =(document.body.clientHeight/2) - (idTourContainerLayer3.offsetHeight/2);
  46. }
  47. function MakeVisible(){
  48.     idTourContainerLayer1.style.visibility = "visible";
  49.     idTourContainerLayer2.style.visibility = "visible";
  50.     idTourContainerLayer3.style.visibility = "visible";
  51.     idTopicsTitle.style.visibility = "visible";                //--- Layer 3
  52.     idTopicsContainer.style.visibility = "visible";            //--- Layer 3
  53.     idTblTopics.style.visibility = "visible";                //--- Layer 3
  54.     idCloseWindow.style.visibility = "visible";            //--- Layer 3
  55.     idControlsContainer.style.visibility = "visible";        //--- Layer 3
  56. }
  57. function NextSlide(){
  58.     if (mNextSlide == "yes") {
  59.         mSlideIdx++;
  60.         DisplaySlide(mSlideIdx);
  61.     }
  62. }
  63. function ShowTip(sStr){
  64.         idTips.innerHTML = sStr;
  65.         setInTransition( idTipsContainer,1, 12 );
  66. }
  67. function HideTip(){
  68.         setOutTransition( idTipsContainer,1, 12 );
  69. }
  70. function HideGlobe(sURL){
  71.     setOutTransition(idGlobe,1, 12 );
  72. }
  73. function ShowGlobe(){
  74.     setInTransition(idGlobe,1, 12 );
  75. }
  76. function UpdateGlobe(sURL){
  77.     if ( sURL ){
  78.         sURL = "url(" + mImgRoot + sURL + ")";
  79.         idGlobe.style.backgroundImage = sURL;
  80.     }
  81. }
  82. function setOutTransition( element, duration, transition ){
  83.     var trsn = "revealTrans(DURATION=" + duration + ", TRANSITION=" + transition + ")";
  84.     element.style.filter = trsn;
  85.     if ( element.filters.revealTrans){
  86.         if (element.filters.revealTrans.status != 2){
  87.             element.style.visibility="visible";
  88.             element.filters.revealTrans.apply();
  89.             element.style.visibility="hidden";
  90.             element.filters.revealTrans.play();
  91.         }
  92.         else{
  93.             element.style.visibility="hidden";
  94.         }
  95.     }
  96. }
  97. function setInTransition( element, duration, transition ){
  98.     var trsn = "revealTrans(DURATION=" + duration + ", TRANSITION=" + transition + ")";
  99.     element.style.filter = trsn;
  100.     if ( element.filters.revealTrans){
  101.         if (element.filters.revealTrans.status != 2){
  102.             element.style.visibility="hidden";
  103.             element.filters.revealTrans.apply();
  104.             element.style.visibility="visible";
  105.             element.filters.revealTrans.play();
  106.         }
  107.         else{
  108.             element.style.visibility="visible";
  109.         }
  110.     }
  111. }
  112. function DisplaySlide(nIdx){
  113.     idTextContainer.document.location = SLIDE_ROOT + nIdx + SLIDE_EXT;
  114.     HighlightSectionTopic(nIdx);
  115.     ShowGlobe();
  116. }
  117. function HighlightSectionTopic(nIdx){
  118.     var row;
  119.     for (row = 0; row < idTblTopics.rows.length; row++ ){
  120.         idTblTopics.rows(row).cells(0).firstChild.className = "clsTopicElementNormal";
  121.     }
  122.     idTblTopics.rows(nIdx).cells(0).firstChild.className = "clsTopicElementSelected";
  123. }
  124. function OnClickSections(oObj)
  125. {    
  126.     idTextContainer.mParent = 0;
  127.     if ( idTips.innerText.length > 0 ) { idTips.innerHTML = ""; HideTip()};
  128.     if (idPlayButton.STATE == 1) PlayButtonOnClick(idPlayButton);
  129.     
  130.     mSlideIdx = oObj.parentElement.parentElement.rowIndex;
  131.     DisplaySlide(mSlideIdx);
  132. }
  133. function OnLoadSlide(oObj)
  134. {
  135.     idTextContainer.mParent = window;
  136. }
  137. function SlideSpeed(nValue){
  138.     idTextContainer.SlideSpeed(nValue);
  139. }
  140. function SetSlideSpeed(nValue){
  141.     mSpeed = nValue;
  142.     SlideSpeed(mSpeed);
  143. }
  144. function ActiveTime(nValue)
  145. {
  146.     if (typeof(idActiveTime) != "undefined") idActiveTime.innerText = parseInt(nValue);
  147. }
  148. function NextTrans(){
  149.     return (++mTransition)%24;
  150. }
  151. function RandomTrans(){
  152.     var a = Rand(13);
  153.     var c = Rand(17);
  154.     return ( a + c )%24;
  155. }
  156. function Rand(base){
  157.     seed = Math.random();
  158.     seed = (seed * 100)% base;
  159.     seed = Math.round(seed);
  160.     return seed;
  161. }
  162. function CheckKeyCodes()
  163. {
  164.     switch (event.keyCode)
  165.     {
  166.         case 27 :
  167.             window.close();
  168.         case 13 :
  169.             
  170.         default :
  171.     }
  172. }
  173. function OnKeyUpTopic(oObj)
  174. {
  175.     switch (event.keyCode)
  176.     {        
  177.         case 13 :
  178.             OnClickSections(oObj);
  179.     }
  180. }
  181. function OnKeyUpSpeedButton(oObj)
  182. {
  183.     switch (event.keyCode)
  184.     {        
  185.         case 13 :
  186.             SpeedButtonOnClick(oObj);
  187.     }
  188. }
  189. function OnKeyUpPlayButton(oObj)
  190. {
  191.     switch (event.keyCode)
  192.     {        
  193.         case 13 :
  194.             PlayButtonOnClick(oObj);
  195.     }
  196. }
  197. function OnKeyUpSoundButton(oObj)
  198. {
  199.     switch (event.keyCode)
  200.     {        
  201.         case 13 :
  202.             SoundButtonOnClick(oObj);
  203.     }
  204. }    
  205.